<?php

require('lib/mel_mysql.php');

require('cfg.php');

echo 'Connecting to MySQL database...<br>';
if (db::connect(cfg::$mysql_host, cfg::$mysql_user, cfg::$mysql_pass, cfg::$mysql_base, true)) {
	echo 'Connecting to MySQL database completed!<br>';
	echo 'Setup tables...<br>';
	if (($es = db::import('setup.sql')) === true) {
		echo '<span style="color: #009900"><b>Setup tables completed!</b></span><br><br>';
		echo 'For security reason, please remove both setup.php and setup.sql files!<br>';
	} else {
		echo '<span style="color: #990000"><b>Setup tables failed!</b></span><br><br>';
		foreach ($es as $e) {
			echo $e . '<br>';
		}
	}
} else {
	echo '<span style="color: #990000"><b>Connecting to MySQL database failed!</b></span><br>';
}

?>